<template>
  <div>
    <h1>密码修改</h1>
     <el-form>
       <el-form-item label="用户名">
          <el-input v-model="updateUser.username"></el-input>
       </el-form-item>
       <el-form-item label="密码">
          <el-input type="password" v-model="updateUser.password"></el-input>
       </el-form-item>
       <el-form-item label="电话">
          <el-input v-model="updateUser.phone"></el-input>
       </el-form-item>
       <el-form-item>
         <el-button type="primary" @click="change()">确认修改</el-button>
         <el-button @click="reset()">取消</el-button>
       </el-form-item>
     </el-form>
  </div>
</template>

<script>
  export default{
    data() {
      return{
        updateUser:{
          username: '',
          password:'',
          phone: '',
         
        }
      }

    },
    methods:{
      async change(){
        const {data:result} = await this.$http.put("/user/update",this.updateUser)
        if(result.status !== 200) return this.$message.error("您填写的信息有误")
        this.$message.success("密码修改成功")
        this.$router.push("/login")
      },
      reset(){
        this.$router.push("/login")
      }
    }
  }
</script>

<style>
</style>
